package com.oracle.application.UserController;

import com.oracle.application.feign.UserFeign;
import com.oracle.application.feign.vo.UserVo;
import com.oracle.application.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 李源浩
 * @Date 2021/7/7 11:26
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
public class userController {

    @Autowired
    private UserFeign userFeign;

    //获取全部会员数据
    @GetMapping("/list")//查询
    public List<UserVo> list(){
        return this.userFeign.list();
    }


    //用户登录
    @GetMapping("/login")
    public R<UserVo> login(@RequestParam("loginnames") String loginnames,@RequestParam("pwd") String pwd){
        return this.userFeign.login(loginnames,pwd);
    }


    //用户注测
    @PostMapping("/addUser")
    public R<UserVo> addUser(@RequestBody UserVo userVo){
        return this.userFeign.addUser(userVo);
    }

    //发送验证码
    @GetMapping("/email")
    public R checkedRandom(@RequestParam("email") String email){
        System.out.println(11111111);
        return this.userFeign.checkedRandom(email);
    }

    //比较验证码
    @GetMapping("/ym")
    public R<UserVo> ym(@RequestParam("ym") String ym){
        return this.userFeign.ym(ym);
    }

    //用户修改信息
    @PutMapping("/updateUser")
    public R<UserVo> updateUser(@RequestBody UserVo userVo){
        return this.userFeign.updateUser(userVo);
    }




}
